(function(win){
	/**
     * 主流网站分享链接地址
     */
    share.website = {
    	//QQ空间
    	qzone : {
    		address : 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pics'
    		},
    		features : {
    			width: 670,
    			height: 630
    		}
    	},
    	//腾讯微博
    	tqq : {
    		address : 'http://share.v.t.qq.com/index.php?c=share&a=index',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pic'
    		},
    		features : {
    			width: 660,
    			height: 520
    		}
    	},
    	//QQ好友
    	cqq : {
    		address : 'http://connect.qq.com/widget/shareqq/index.html',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pics'
    		},
    		features : {
    			width: 810,
    			height: 640
    		}
    	},
    	//新浪微博
    	sina : {
    		address : 'http://service.weibo.com/share/share.php',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pic'
    		},
    		features : {
    			width: 660,
    			height: 650
    		}
    	},
    	//网易微博
    	t163 : {
    		address : 'http://t.163.com/article/user/checkLogin.do',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'info',
    			pic: 'togImg'
    		}
    	},
    	//人人网
    	renren : {
    		address : 'http://widget.renren.com/dialog/share',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pic'
    		}
    	},
    	//开心
    	kaixin : {
    		address : 'http://www.kaixin001.com/login/open_login.php',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pic'
    		}
    	},
    	//豆瓣
    	douban : {
    		address : 'http://www.douban.com/share/service',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pic'
    		}
    	},
    	//搜狐
    	sohu : {
    		address : 'http://t.sohu.com/third/post.jsp',
    		alias : {
    			url : 'url',
    			title: 'title',
    			summary : 'summary',
    			pic: 'pic'
    		}
    	}
    }
	/**
     * 分享
     * @param name {String} 分享网站名称
     * @param url {String} 网站地址
     * @param title {String} 分享标题
     * @param summary {String} 分享描述
     * @param pic {String|Array} 分享图片
     * @return void
     */
	function share(name, url, title, summary, pic){
		var _address = '', _param = {}, _features = [];
		if(typeof name == 'string'){
			if(name in share.website){
				_address = share.website[name]['address'];
				url = typeof url == 'string' ? url : location.href;
				title = typeof title == 'string' ? title : document.title;
				summary = typeof summary == 'string' ? summary : $('meta[name=description]').text();
				pic = $.isArray(pic) ? pic : pic;
				_param[share.website[name]['alias']['url']] = url;
				_param[share.website[name]['alias']['title']] = title;
				_param[share.website[name]['alias']['summary']] = summary;
				_param[share.website[name]['alias']['pic']] = pic;
				_param = $.param(_param);
				_address = _address + (_address.indexOf('?') >= 0 ? '&'+_param : '?'+_param);
				var _websiteFeatures = share.website[name]['features'];
				if($.isPlainObject(_websiteFeatures)){
					var _windowSize = {width: $(window).width(), height: $(window).height()};
					if(_websiteFeatures['width']){
						_features.push('width='+_websiteFeatures['width']);
						_features.push('left='+(_windowSize.width - _websiteFeatures['width'])/2);
					}
					if(_websiteFeatures['height']){
						_features.push('height='+_websiteFeatures['height']);
						_features.push('top='+(_windowSize.height - _websiteFeatures['height'])/2);
					}

				}
				window.open(_address, '__'+name+'Share', _features.join(','), true);
			}else{
				throw new Error("网站名称不存在！");
			}
		}else{
			throw new Error("必须指定分享网站名称！");
		}
	}
	$.share = function(name, url, title, summary, pic){
		return share.apply(null, arguments);
	}
})(window);